define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'order.order/index',
        add_url: 'order.order/add',
        edit_url: 'order.order/edit',
        delete_url: 'order.order/delete',
        export_url: 'order.order/export',
        modify_url: 'order.order/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: 'id'},                    {field: 'user_id', title: '用户'},                    {field: 'order_sn', title: '订单编号'},                    {field: 'status', search: 'select', selectList: ea.getDataBrage('select_list_status'), title: '状态', templet: ea.table.switch},                    {field: 'order_type', search: 'select', selectList: ea.getDataBrage('select_list_order_type'), title: '订单类型'},                    {field: 'order_money', title: '订单金额'},                    {field: 'payable_money', title: '应付金额'},                    {field: 'real_money', title: '实付金额'},                    {field: 'pay_type', title: '支付方式'},                    {field: 'pay_status', search: 'select', selectList: ea.getDataBrage('select_list_pay_status'), title: '支付状态'},                    {field: 'transaction_id', title: '第三方支付订单id'},                    {field: 'pay_time', title: '支付时间'},                    {field: 'create_time', title: '创建时间'},                    {field: 'user.user_nickname', title: '昵称'},                    {field: 'user.mobile', title: '手机号'},                    {width: 250, title: '操作', templet: ea.table.tool , fixed:'right'},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});